package com.xs.designpattern;

import lombok.extern.slf4j.Slf4j;

/**
 * @author xs
 */
@Slf4j
public class Main {
    public static void main(String[] args) {
        OliphauntPool pool = new OliphauntPool();
        log.info(pool.toString());
        Oliphaunt oliphaunt1 = pool.checkOut();
        String checkedOut = "从对象池中拿出 {}";
        log.info(checkedOut, oliphaunt1);
        log.info(pool.toString());
        Oliphaunt oliphaunt2 = pool.checkOut();
        log.info(checkedOut, oliphaunt2);
        Oliphaunt oliphaunt3 = pool.checkOut();
        log.info(checkedOut, oliphaunt3);
        log.info(pool.toString());
        log.info("放入对象池中 {}", oliphaunt1);
        pool.checkIn(oliphaunt1);
        log.info("放入对象池中 {}", oliphaunt2);
        pool.checkIn(oliphaunt2);
        log.info(pool.toString());
        Oliphaunt oliphaunt4 = pool.checkOut();
        log.info(checkedOut, oliphaunt4);
        Oliphaunt oliphaunt5 = pool.checkOut();
        log.info(checkedOut, oliphaunt5);
        log.info(pool.toString());
    }
}